<template>
	<view>
		<nav-bar color="#000000" bgc="#ffffff" bbtn>申请售后</nav-bar>
		<view class="section-1">
			<view class="title">售后/退款原因：</view>
			<view class="textarea">
				<view class="inuptNum">{{ inuptNum.length }}/500</view>
				<textarea maxlength="500" placeholder="请输入" v-model="inuptNum"></textarea>
			</view>
		</view>
		<view class="section-2" @click="submit">提交申请</view>
		<view class="tips">申请通过后，资金将通过原路返回</view>
		<dialogview v-show="dialogFlag" @cancel="cancel" @confirm="confirm" :param="dialogView"></dialogview>
	</view>
</template>
<script>
import dialogview from "../../components/dialogView.vue" //弹窗组件
export default {
	components: {
		dialogview
	},
	data() {
		return {
			inuptNum: '',
			chars: 0,
			id: 0,
			dialogView: {
				style: 0, // 弹出框的样式： 0 1 2
				title: '提示', //弹出层的标题
				content: '确定要这样做吗确定要这样做吗确定要这样做吗确定要这样做吗？', //弹出层的内容
				cancelText: '取消', //取消按钮的文本
				confirmText: '确认', //确认按钮的文本
				data: {
					code: 1000
				}
			},
			dialogFlag: false,
		};
	},
	methods: {
		// keyup:function(){
		// 	console.log(this.inuptNum)
		// }
		submit(){
			if (!this.inuptNum) {
				uni.showToast({
					title: '请填写售后理由',
					icon: 'none',
					duration: 2000
				});
				return false;
			}
			let params = {
				id: this.id,
				content: this.inuptNum
			};
			this.ajaxJson('applyService', params, res => {
				this.dialogView = {
					style: 2, // 弹出框的样式： 0 1 2
					title: '提交成功', //弹出层的标题
					content: '平台审核中，请注意查看审核状态', //弹出层的内容
					confirmText: '好的', //确认按钮的文本
					data: {}
				}
				this.confirm = this.confirmBack;
				this.dialogFlag = true;
			});
		},
		confirm(){},
		confirmBack(){
			uni.navigateBack({
				
			})
		}
		
	},
	onLoad(options) {
		this.id = options.id;
	}
};
</script>

<style lang="scss" scoped>
* {
	padding: 0;
	margin: 0;
	font-size: 0.75rem;
	box-sizing: border-box;
}
page {
	background: #FFFFFF;
}
.section-1 {
	margin-top: 120rpx;
	padding: 20rpx;
	.textarea {
		background-color: #fff7f4;
		border-radius: 20rpx;
		position: relative;
		padding: 20rpx;
		width: 100%;
		height: 500rpx;
		.inuptNum {
			position: absolute;
			bottom: 10rpx;
			right: 10rpx;
		}
		textarea {
			width: 100%;
			height: 100%;
		}
	}
}
.section-2 {
	width: 80%;
	margin: 50rpx auto;
	height: 100rpx;
	border-radius: 50rpx;
	color: #ffffff;
	text-align: center;
	line-height: 100rpx;
	font-size: 34rpx;
	background: linear-gradient(to right, #fd6431, #ff9972);
}
.tips{
	width: 100%;
	margin-top: 50rpx;
	text-align: center;
	color: #AAAAAA;
}
</style>
